<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>化验单_ 三级联动</title>
    <!-- Bootstrap -->
    <link href="../../../../../index.php" rel="stylesheet">
    <link rel="stylesheet" href="../../../../../index.php"/>
    <link rel="stylesheet" href="../../../../../index.php"/>
    <link rel="stylesheet" href="../../../../../index.php"/>
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script>
        function check(id) {
            var frameSrc = "{:U('Operation/showHydList')}"+"?id="+id;
            $("#hylx").attr("src", frameSrc);
            $('#hylxModal').modal({ show: true, backdrop: 'static' });
        }
    </script>
    <style>
        .title {
            width: 352px;
            display: inline-block;
            vertical-align: top;
        }

        #one_yi, #two_er {
            border-top: 1px solid #dddddd;
            width: 352px;
            display: inline-block;
            vertical-align: top;
            height: 350px;
            overflow: auto;
        }

        #one_yi li, #two_er li, #three_san li {
            width: 100%;
            line-height: 30px;
            border-bottom: 1px solid #dddddd;
            padding: 0 10px;
            cursor: pointer;
        }

        .set {
            background: #15ACF3;
            color: #FFFFFF;
        }

        #two_er ul:not(:first-child) {
            display: none;
        }

        #three_san ul:not(:first-child) {
            display: none;
        }

        .name_title {
            width: 100%;
            margin: 15px 0;
        }

        ::-webkit-scrollbar {
            width: 2px;
        }

        /* 滚动槽 */
        ::-webkit-scrollbar-track {
            -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
            border-radius: 10px;
        }

        /* 滚动条滑块 */
        ::-webkit-scrollbar-thumb {
            border-radius: 10px;
            background: rgba(0, 0, 0, 0.1);
            -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
        }

        ::-webkit-scrollbar-thumb:window-inactive {
            background: rgba(0, 0, 0, 0.4);
        }
    </style>
</head>
<body>
<div id="Laboratory" style="width:750px;padding:0 20px;margin:0 auto;"> <!--背景色、边框、阴影-->
    <div class="name_title">
        <p class="title"><b>请选择化验类型</b></p>

        <p class="title"><b>请选择化验项</b></p>
    </div>
    <form action="{:U('Operation/addAssay')}"  method="post" style="border: 1px solid #ddd;border-right: none"  >
        <volist name="row" id="data">
            <input type="hidden" name="doctor_id" value="{$data['doctor_id']}">
            <input type="hidden" name="patient_id" value="{$data['patient_id']}">
            <input type="hidden" name="id" value="{$data['id']}">
        </volist>
        <div id="wrap">
            <ul id="one_yi">
            <select class="select Validform_error" size="1" name="medical_id" datatype="*" onchange="onchangeMedical($(this))" nullmsg="请选择" id="form" onchange="submitFun()">
                <option value=""  selected="">请选择</option>
                <volist name="list" id="data">
                    <option value="{$data['id']}" id="options" >
                            <li class="set" value="{$data['title']}" >
                                {$data['title']}
                            </li>
                    </option>
                </volist>
                <input type="hidden" name="options_values" id="options_values" value="">
            </select>
            </ul>
              <div id="two_er">
                        <ul>
                            <select class="select Validform_error" size="1" name="me_type" datatype="*" nullmsg="请选择" id="meType">
                                <option value="" selected="" disabled="disabled" name="id">
                                    <li class="meType">请选择</li>
                                </option>
                            </select>
                        </ul>
                    </div>
                </div>
        <!--<p class="text-center" style="position: relative;top:16px;left:120px;">-->
            <input type="submit" class="btn btn-danger" value="提交">
        <!--</p>-->
    </form>
</div>
<p>

</p>
<script src="../../../../../index.php"></script>
<script src="../../../../../index.php"></script>
<script>
    $('#one_yi li').click(function () {
        var i = $(this).index();
        $(this).addClass('set').siblings().removeClass('set');
        $('#two_er ul').eq(i).show().siblings().hide();
    });
    $('#two_er ul li').click(function () {
        var i = $(this).index();
        $(this).addClass('set').siblings().removeClass('set');
        $('#three_san ul').eq(i).show().siblings().hide();
    });

</script>
<script type="text/javascript">
    function onchangeMedical(jqObj){
        var medical_id = jqObj.val();
        var metypecheck = $('#meType');
        metypecheck.html('');
        $.ajax({
            url: '{:U("Operation/getMeTypeListJson")}?medical_id=' + medical_id,
            type: 'post',
//            enctype: 'multipart/form-data',
            success: function (data) {
                $.each(data, function (i, item) {
                    metypecheck.append('<option value="' + item.id + '" >' + item.title + '</option>');

                });
            },
        });

    }
</script>
<script>
function submitFun(){
    //得到select下拉列表中option的value
    var optionValue = document.getElementById("form").lis[document.getElementById("form").lis.selectedIndex].value;
    alert(optionValue);
    //得到select下拉列表中option的text
//    var optionText = document.getElementById("form").options[document.getElementById("form").options.selectedIndex].text;
//    alert(optionText);
//    var form = $('#form').second.children(option);
//    alert(form);
//        var str = '';
//        var i;
//        for(i=0;i<form.length;i++){
//            str += form[i].innerText + ',';
    document.getElementById('options_values').value = optionText;
//        }
}
</script>
</body>
</html>